home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / database / postgres / appgen-0.2-a / appgen-0 / AppGEN / src / lib / html.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-10  |  713 b   |  35 lines

  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. void ag_get_html(char *filename) 
  7. {
  8.     FILE *html;
  9.     int a;
  10.     html=fopen(filename,"rt");
  11.     if (html==NULL) exit(1);
  12.     printf("Content-Type: text/html\n\n");
  13.     while(!feof(html)) {
  14.         a=fgetc(html);
  15.         if (!feof(html)) printf("%c",a); 
  16.         }
  17.     fclose(html);    
  18. }
  19.  
  20. void ag_jump_module(char *filename, char *process, char *variable, char *value)
  21. {
  22.     char args[1024],qs[1024],env[1024];
  23.     strcpy(env,"QUERY_STRING=");
  24.     strcpy(args,"AG_PROCESS=");
  25.     strcat(args,process);
  26.     strcat(args,"&");
  27.     strcat(args,variable);
  28.     strcat(args,"=");
  29.     strcat(args,value);
  30.     strcpy(qs,getenv("QUERY_STRING"));
  31.     strcat(env,args);
  32.     putenv(env);
  33.     execl(filename,args,NULL);    
  34. }
  35.